package com.kyjszj.modules.product.controller;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kyjszj.modules.product.entity.Result;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/swagger")
@Api(value="testRest",description="测试信息",tags="TestController")
public class TestController {

    @RequestMapping(value = "/listCompound", method = RequestMethod.GET)
    @ResponseBody
    @ApiResponses(value = {
            @ApiResponse(code = 500, message = "系统错误"),
            @ApiResponse(code = 200, message = "0 成功,其它为错误,返回格式：{code:0,data[{}]},data中的属性参照下方Model", response = Result.class)})
    @ApiOperation(httpMethod = "GET", value = "个人信息")//swagger 当前接口注解
    public String listCompound() {
        List data = new ArrayList();
        String msg = data.size() > 0 ? "111" : "没有查询到相关记录";
        Result result = new Result();
        result.setMsg(msg);
        result.setCode(0);
        result.setData(data);
        return JSONObject.toJSONString(result);
    }
}